﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace RoboRace_Shared
{
    //WALL's are used to create points on the BOARD that will inhibit movement.
    
    [Serializable]
    public class Wall
    {
        private Coordinate _coordinate;
        private COMPASS _compass;

        //WALL constructor
        public Wall(Coordinate coord, COMPASS compass)
        {
            //We have to validate that the arguments being passed actually contain data.
            if (coord != null)
            {
                _coordinate = coord;
                _compass = compass;
            }
            else
            {
                throw new ArgumentException("COORDINATE variables cannot be null");
            }
        }

        //This is used to identify which TILE the WALL will be placed.
        public Coordinate Coordinates { get { return _coordinate; } }

        //This is used to get the COMPASS location on the TILE where the WALL is to be placed.
        public COMPASS Compass { get { return _compass; } }

        //This is used to get the COMPASS location directly opposite where the WALL is actually sitting.  
        //This will be used in collision detection code later.
        public COMPASS CompassOpposite
        {
            get
            {
                switch (_compass)
                {
                    case COMPASS.NORTH:
                        return COMPASS.SOUTH;
                    case COMPASS.SOUTH:
                        return COMPASS.NORTH;
                    case COMPASS.EAST:
                        return COMPASS.WEST;
                    case COMPASS.WEST:
                        return COMPASS.EAST;
                    default:
                        //this will never be executed.
                        return COMPASS.NORTH;
                }
            }
        }
    }
}
